#ifndef __STDMYSTRING_H_
#define __STDMYSTRING_H_
#include <string>
class MyStringList;
class StdMystring
{
    friend std::ostream &operator<<(std::ostream &os, const StdMystring &str);
    friend std::istream &operator>>(std::istream &is, StdMystring &str);

public:
    StdMystring();
    StdMystring(const char *str);
    StdMystring(const StdMystring &str);
    StdMystring operator+(const StdMystring &str);
    StdMystring operator-(const StdMystring &str);
    StdMystring &operator=(const StdMystring &str);
    StdMystring &operator+=(const StdMystring &str);
    StdMystring &operator+=(const char c);
    MyStringList split(const StdMystring &str);
    bool operator==(const StdMystring &str);
    bool operator!=(const StdMystring &str);
    bool operator>(const StdMystring &str);
    bool operator&&(const StdMystring &str);
    char &operator[](int index);
    operator int();
    operator double();
    ~StdMystring();

    static StdMystring number(int a);

private:
    char *s;
    int size;     // 长度
    int capacity; // 容量
};
std::ostream &operator<<(std::ostream &os, const StdMystring &str);
std::istream &operator>>(std::istream &is, StdMystring &str);

class MyStringList
{
    friend std::ostream &operator<<(std::ostream &os, const MyStringList &list);

private:
    StdMystring *string;
    int size;
    int capacity;

public:
    MyStringList();
    ~MyStringList();
    void removeByIndex(int index);
    MyStringList &operator+=(const StdMystring &str);
    MyStringList &operator-=(const StdMystring &str);
    StdMystring &operator[](int idx);
};
std::ostream &operator<<(std::ostream &os, const MyStringList &list);
#endif